﻿using System.Windows.Input;
using MainGameModule.Models;
using MainGameModule.Views;
using Microsoft.Practices.Composite.Presentation.Commands;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Unity;
using YourWorld.Common;

namespace MainGameModule.ViewModels
{
    public class PartnersViewModel : ViewModelBase
    {
        private IRegionManager regionManager;
        private IUnityContainer container;
        private IGameModel gameModel;

        public ICommand ClosePartnersCommand
        {
            get;
            private set;
        }

        public PartnersViewModel(IRegionManager regionManager, IUnityContainer container, IGameModel gameModel)
        {
            this.regionManager = regionManager;
            this.container = container;
            this.gameModel = gameModel;
            this.ClosePartnersCommand = new DelegateCommand<string>(this.ClosePartnersView);
        }

        private void ClosePartnersView(string notUsed)
        {
            this.regionManager.Regions[RegionNames.GamePopUpRegion].Deactivate(this.container.Resolve<Partners>());
        }
    }
}